#include "stdafx.h"
#include "SessionManager.h"
#include "CompletionPortServer.h"



int CSessionManager::PostSend(const char* buf, int len, CCompletionPortServer* server)
{
    int n = 0;
    for (auto it : clients_)
    {
        CIOContext* p = new CIOContext;
        p->m_OpType = SEND_POSTED;
        p->m_sockAccept = it->m_Socket;
        memcpy(p->m_szBuffer, buf, len);
        p->m_wsaBuf.len = len;
        if (server->PostSend(p))
        {
            ++n;
        }
    }
    return n;//clientContext_.Send(buf, len);
}
